package com.zc.commons.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

public class ExceptionUtils {

    public static String getStackTrace(Throwable e) {
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
        e.printStackTrace(printWriter);
        if (printWriter != null) {
            printWriter.flush();
            printWriter.close();
        }
        return stringWriter.toString();
    }

}
